﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using Cwing.UI.Controls;

public partial class Customize_Validation : ValidationPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        ValidationTextBox2.Validated += new Cwing.UI.Validation.ControlValidated(ValidationTextBox2_Validated);
    }

    void ValidationTextBox2_Validated(Cwing.UI.Validation.ValidateEventArgs e, Cwing.UI.Validation.ValidationResult result)
    {
        if (!result.IsEmpty && result.Result)
        {
            if (!ValidationTextBox1.ValidationResult.IsEmpty && ValidationTextBox1.ValidationResult.Result)
            {
                if (ValidationTextBox1.Text != ValidationTextBox2.Text)
                {
                    result.Result = false;
                    result.Message = "value of the ValidationTextBox1 is different to ValidationTextBox2";
                }
            }
        }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        Response.Write(PageValidate());
    }
}
